package com.lindom.dao;

import com.lindom.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface UserMapper {

    @Select("select * from user")
    List<User> getUsers();

    @Select("select * from user where id = #{uid}")
    User getUsersById(@Param("uid") int id);  //当只有一个参数时，可不用@Param；但当有多个参数时，必须得用！
                                                //只有基本数据类型和String得用，自己创建的类不用

    @Insert("insert into user (id, name, pwd) values(#{id}, #{name}, #{password})")
    int addUser(User user);

    @Delete("delete from user where id = #{mid}")
    int deleteUser(@Param("mid")int id);

    @Update("update user set name = #{name}, pwd = #{password} where id = #{id} ")
    int updateUser(User user);


}
